﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace SSRSViewer.Core
{
    public class RdlValidValuesParser
    {
        public string DatasetName { get; private set; }
        public string ValueField { get; private set; }
        public string LabelField { get; private set; }

        public RdlValidValuesParser(XmlNode validValues)
        {
            foreach (XmlNode dsr in validValues)
                if (dsr.Name == "DataSetReference")
                    foreach (XmlNode dsinfo in dsr.ChildNodes)
                        switch (dsinfo.Name)
                        {
                            case "DataSetName":
                                DatasetName = dsinfo.InnerText;
                                break;
                            case "ValueField":
                                ValueField = dsinfo.InnerText;
                                break;
                            case "LabelField":
                                LabelField = dsinfo.InnerText;
                                break;
                        };
        }
    }
}
